home *** CD-ROM | disk | FTP | other *** search
- Path: lisa.cs.mcgill.ca!milosz
- From: milosz@cs.mcgill.ca (Jean-Luc MANIGAT)
- Newsgroups: comp.lang.c++
- Subject: Pointers to functions
- Date: 3 Apr 1996 00:44:46 GMT
- Organization: SOCS, McGill University, Montreal, Canada
- Message-ID: <4jshlu$sv9@lisa.cs.mcgill.ca>
- NNTP-Posting-Host: willy.cs.mcgill.ca
-
- Say you have a function that takes a function for an argument:
-
- void print(int (*f)(int, int), int a, int b) {
- cout << f(a, b);
- }
-
- Fine, but in "More C++ in 21 days", when they used a some member
- function, they did something like:
-
- void print(int (X::*f)(), X& x) {
- cout << x.*f();
- }
-
- Now how come you have to dereference the pointer in one case, and not in
- the other? I've tried doing cout << x.f(); and it doesn't work.
-
- E-Mail replies greatly appreciated.
-
- --
- J
-
- - Mamo, dlaczego ten Murzyn tak pije?
- - Bo chce mu sie pic.
-